home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.6 KB | 122 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWSymFil.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifdef FW_DEBUG
-
- #ifndef FWENVDEF_H
- #include "FWEnvDef.h"
- #endif
-
- #if !defined(FWSYMFIL_H) && defined(FW_DEBUG) && defined (FW_BUILD_WIN16)
- #define FWSYMFIL_H
-
- #ifndef FWSTDDEFS_H
- #include "FWStdDef.h"
- #endif
-
- #if !defined(__INC_WINDOWS)
- #include <windows.h>
- #endif
-
- //========================================================================================
- // FW_CPrivWinSymFile:
- //
- // Interface to Windows format .SYM files. They are generated from link .MAP
- // files by Microsoft MAPSYM tool and contain a list of publics in a module sorted
- // by segment and Offset. We use .SYM files to produce better FW_DEBUG printouts.
- //========================================================================================
-
- class FW_CPrivWinSymFile
- {
- public:
- FW_CPrivWinSymFile(const char* pzFileName);
- /* Tries to load a .SYM file defined by pzFileName. If the load fails, no
- fError is generated as SYM files are optional. */
-
- ~FW_CPrivWinSymFile(void);
- /* Frees fMemory allocated for the symbol data storage. */
-
- FW_Boolean FindSymbol(unsigned short wSeg,
- unsigned short fOffset,
- unsigned short cbMaxLen,
- char* pzName);
- /* Attempts to locate a symbol in the file. wSeg is the ordinal segment
- number in a Windows executable file and wOfs is the Offset within that
- segment. If succesfull, copies the name to pzName, cbMaxLen is the buffer
- size. */
-
- private:
- void* fSymData;
-
- FW_CPrivWinSymFile(const FW_CPrivWinSymFile& symFile);
- FW_CPrivWinSymFile& operator=(const FW_CPrivWinSymFile& symFile);
- // Don't copy instances of this class.
- };
-
-
- //========================================================================================
- // FW_CPrivWinDebugModuleList:
- //
- // A class for obtaining symbolic info on Windows modules. Useful for stack
- // walk and FW_DEBUG messages.
- //========================================================================================
-
- class FW_CPrivWinDebugModuleList
- {
- public:
- static void Initialize(void);
- static void Terminate(void);
-
- static FW_Boolean FindSymbol(HANDLE fModule,
- unsigned short wSeg,
- unsigned short fOffset,
- unsigned short cbMaxLen,
- char* pzName);
- /* Attempts to locate a symbol in a Windows module. See comment for
- FW_FW_CSymFile::FindSymbol above. fModule is the module handle as returned
- by TOOLHELP.DLL: do not pass instance handles! */
-
- static FW_Boolean GetModuleName(HANDLE fModule,
- char* pzName);
- /* Returns a short 8-char name of module identified by handle fModule. */
-
- enum
- {
- kMaxModules = 64,
- kModuleNotFound = 128
- };
-
- private:
- struct sOneModule
- {
- HANDLE fModule;
- FW_CPrivWinSymFile* fSymFile;
- char fModuleName[10];
- };
-
- static sOneModule fModules[];
- static unsigned short fNumberOfModules;
-
- static unsigned short FindModule(HANDLE fModule);
- /* Searches the list for the module identified by fModule. If the module is not
- present yet, creates a new fEntryArray creates a FW_CPrivWinSymFile for it. Returns module index
- on success, kModuleNotFound on failure */
-
- static unsigned short AddModule(HANDLE fModule);
- /* Called by FindModule When the module fModule is not present in the list. */
-
- FW_CPrivWinDebugModuleList();
- // Don't construct this object.
- };
-
-
- #endif // FWSYMFIL_H
-
- #endif // FW_DEBUG
-